<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet"href="https://cdn.staticfile.org/font-awesome/6.0.0/css/all.css">

		<link rel="stylesheet" href="{{ static('css/index.css') }}"/>

		<!-- 新 Bootstrap5 核心 CSS 文件 -->
		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css">

	</head>
	<body style="height: auto">
       <div class="head">

           <a href="{{ url('mainPage') }}" class="nav-link"><div class="h3">Haoyunlai driving school</div></a>

           <nav class="navbar navbar-expand-sm">

              <!-- Links -->
              <ul class="navbar-nav">
                <li class="nav-item">
                  <a class="nav-link" href="{{ url('index') }}">Home</a>
                </li>
                  {% if user.identity_c == '1' %}
                  {% else %}
                <li class="nav-item">
                  <a class="nav-link" href="{{ url('cindex') }}">Appiontment training</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="{{ url('book_exaln@index') }}">Appiontment examination</a>
                </li>
                  {% endif %}
              </ul>

            </nav>

            <nav class="navbar navbar-expand-sm ">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" type="top" href="mailto:xxx@xxx.com" target="_blank">Contact us</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" type="top" href="{{ url('onst') }}">About us</a>
                    </li>
                    <li class="nav-item">
                        <a href="{{ url('logout') }}" class="btn btn-danger">Logout</a>
                    </li>
                </ul>
            </nav>
       </div>
        <div class="container-xl">
        <h1>Make an appointment to training</h1>

        {% for time in t_dt %}
            <h1 style="color: #e76a0d">train time {{ time[0] }}-{{ time[1] }}</h1>
            <table class="table table-striped" style="margin-bottom: 3%">
                <thead>
                  <tr>
                    <th>name</th>
                    <th>tel</th>
                    <th>type</th>
                    <th>choose</th>
                  </tr>
                </thead>
                <tbody>

                   {% for i in query %}
                        {% if not tl.objects.filter(teacher=i,date=tz.now().date()) and i.driving_license_type == user.driving_license_type %}
                        <tr>
                            <td>{{ i.name }}</td>
                            <td>{{ i.tel }}</td>

                            <td style="color: #0a58ca">{{ i.get_driving_license_type_display() }}</td>
                            <td>{% if len(blist.objects.filter(student=user,teacher=i).all())<3 %}<a id="choose" class="btn btn-primary active" data-time="{{ time[0].hour }},{{ time[1].hour }}" key="{{ i.name }}" href="#">Choose</a>{% else %}<button class="btn btn-sm btn-danger disabled">blacklist</button>{% endif %}</td>

                          </tr>
                        {% endif %}
                   {% endfor %}
                   {% for i in query %}
                            {% if not tl.objects.filter(teacher=i,date=tz.now().date()) and (not (i.driving_license_type == user.driving_license_type)) %}
                            <tr>
                                <td>{{ i.name }}</td>
                                <td>{{ i.tel }}</td>

                                <td style="color: #e76a0d">{{ i.get_driving_license_type_display() }}</td>
                                <td><a class="btn btn-primary disabled" href="#">Choose</a></td>

                              </tr>
                            {% endif %}
                       {% endfor %}
                    {% for i in query %}
                            {% if  tl.objects.filter(teacher=i,date=tz.now().date())  %}
                            <tr>
                                <td>{{ i.name }}</td>
                                <td>{{ i.tel }}</td>

                                <td style="color: #e76a0d">{{ i.get_driving_license_type_display() }}</td>
                                <td><a class="btn btn-primary disabled" href="#">Coach leave</a></td>

                              </tr>
                            {% endif %}
                       {% endfor %}
                </tbody>
            </table>
        {% endfor %}
        </div>
	</body>

	<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
	<!--  popper.min.js 用于弹窗、提示、下拉菜单 -->
	<script src="https://cdn.staticfile.org/popper.js/2.9.3/umd/popper.min.js"></script>
	<!-- 最新的 Bootstrap5 核心 JavaScript 文件 -->
	<script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.min.js"></script>
	<script src="{{ static('js/index.js') }}"></script>
    <script>init_coach('{{ url('cindex') }}','{{ csrf_token }}','{{ time }}')</script>
</html>
